<template>
  <div class="taskItemApprover">
    <div class="taskItemApprover_title">
      <div class="taskItemApprover_title_return" @click="ReturnsHistory">
        <img src="@/pages/mobile/assets/img/Back@3x.png" alt />
        <!-- <span>{{title}}</span> -->
      </div>
      <p v-if="approverState">确认同意</p>
      <p v-else>确认驳回</p>
    </div>
    <div class="taskItemApprover_content">
      <textarea
        placeholder="请输入审批意见"
        name="textarea"
        id="textarea"
      ></textarea>
    </div>
    <div class="taskItemApprover_button">
      <button v-if="approverState == 1" @click="taskItemApproverY">
        确认同意
      </button>
      <button v-else @click="taskItemApproverN">确认驳回</button>
    </div>

    <toast
      v-model="PositionValue"
      type="text"
      :time="showPositionValuetime"
      is-show-mask
      :text="showPositionValuetext"
      :position="position"
    ></toast>
  </div>
</template>

<script>
import { Toast, Group, XSwitch, XButton } from 'vux'
export default {
  name: '',
  components: {
    Toast,
    Group,
    XSwitch,
    XButton
  },
  data () {
    return {
      PositionValue: false, // 图片识别失败信息提示信息提示
      position: "default", //弹框
      showPositionValuetime: 3000, //弹框显示时间
      showPositionValuetext: "", // 弹框提示信息

    }
  },
  // props: ["childDataType"],
  props: ["approverState"],
  methods: {
    Position (position) {
      this.position = position;
      this.PositionValue = true;

    },
    ReturnsHistory () {
      this.$emit('ApproverChild')
    },
    taskItemApproverY () {
      this.Position("middle");
      this.showPositionValuetext = "审批成功"
      setTimeout(() => {
        this.$emit('ApproverChild')
      }, 3000);
    },
    taskItemApproverN () {
      this.Position("middle");
      this.showPositionValuetext = "驳回成功"
      setTimeout(() => {
        this.$emit('ApproverChild')
      }, 3000);
    }
  },

}
</script>

<style lang='less' scoped>
.taskItemApprover {
  background: #fbf9fe;
  position: fixed;
  top: 0rem;
  bottom: 0.1rem;
  width: 100%;
  height: 100%;
  z-index: 800;
  overflow: hidden;
  .taskItemApprover_title {
    width: 100%;
    height: 0.44rem;
    text-align: center;
    line-height: 0.44rem;
    z-index: 501;
    position: fixed;
    background: #ffffff;
    box-shadow: inset 0 -1px 0 0 rgba(207, 207, 207, 0.2);
    .taskItemApprover_title_return {
      float: left;
      height: 0.44rem;
      line-height: 0.44rem;
      img {
        // width: 0.15rem;
        float: left;
        height: 0.205rem;
        padding-left: 0.085rem;
        vertical-align: baseline;
        margin-top: 0.12rem;
      }
      span {
        float: left;
        font-family: Regular;
        font-size: 0.17rem;
        color: #3e3e3e;
        letter-spacing: -0.41px;
        margin-left: 0.04rem;
        overflow: hidden;
        height: 0.44rem;
      }
    }
    p {
      font-family: Semibold;
      font-size: 0.17rem;
      color: #3e3e3e;
      letter-spacing: -0.41px;
      text-align: center;
      height: 0.44rem;
      line-height: 0.44rem;
      margin-left: 1.1rem;
      margin-right: 1.1rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
  .taskItemApprover_content {
    height: 100%;
    margin-top: 0.44rem;
    background: #fff;
    textarea {
      margin-top: 0.12rem;
      padding: 0 4%;
      height: 80%;
      width: 92%;
      font-family: PingFangSC-Regular;
      font-size: 15px;
      color: rgba(0, 22, 22, 0.85);
      letter-spacing: 0;
      margin-bottom: -76px;
    }
    textarea::placeholder {
      font-family: PingFangSC-Regular;
      font-size: 15px;
      color: #818181;
      letter-spacing: 0;
    }
  }
  .taskItemApprover_button {
    position: absolute;
    bottom: 0px;
    height: 0.76rem;
    width: 100%;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    button {
      width: 91%;
      height: 0.44rem;background: #BE9457;
      border-radius: 4px;
      font-family: PingFangSC-Medium;
      font-size: 18px;
      color: #ffffff;
      letter-spacing: 0;
    }
  }
}
</style>
